﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace SimpleFMMatrix.ViewModel
{
    public class IntValuedDependencyObject : DependencyObject
    {
        private Action<int, int> OnValuedChanged = (o, n) => { };

        public int Value
        {
            get { return (int)GetValue(ValueProperty); }
            set { SetValue(ValueProperty, value); }
        }

        public static readonly DependencyProperty ValueProperty =
            DependencyProperty.Register("Value", typeof(int), typeof(IntValuedDependencyObject),
                new PropertyMetadata(0,
                    (d, e) => ((IntValuedDependencyObject)d).OnValuedChanged((int)e.OldValue, (int)e.NewValue)));

        public IntValuedDependencyObject(int _Value, Action<int, int> _OnValueChanged)
        {
            Value = _Value;

            if (_OnValueChanged != null)
                OnValuedChanged = _OnValueChanged;
        }
    }
}
